import globals from 'globals'
import pluginJs from '@eslint/js'
import { resolve } from 'path' // 新增路径处理

export default [
  { files: ['**/*.js'], languageOptions: { sourceType: 'commonjs' } },
  { languageOptions: { globals: { ...globals.browser, ...globals.node } } },
  {
    ignores: [
      'package-lock.json',
      'package.json',
      'rollup.config.js',
      'node_modules',
      'dist',
    ],
  },
  pluginJs.configs.recommended,
  {
    rules: {
      'no-unused-vars': 'off',
    },
  },
  {
    settings: {
      'import/resolver': {
        alias: {
          map: [
            ['@', resolve('./src')], // 绝对路径映射
          ],
          extensions: ['.js', '.json'],
        },
      },
    },
  },
]